<template>
  <footer class="footer_guide border-1px">
    <div class="guide_item" @click="goto(item.id)" :class="{on: isCurrent(item.id)}" v-for="(item,index) in menu" :key="index">
      <span class="item_icon">
        <i :class="['iconfont', item.icon]"></i>
        <!-- <img :src="item.icon" alt=""> -->
      </span>
      <span>{{item.text}}</span>
    </div>
  </footer>
</template>

<script>
import { mapState } from "vuex";
import { routerById } from "../../util/contact.js";
export default {
  computed: {
    ...mapState(["appInfo"]),
    menu: function() {
      return this.appInfo.bottom || [];
    }
  },
  methods: {
    goto(data) {
      this.$router.replace(routerById[data]);
    },
    isCurrent(data) {
      // console.log(this.$route.path)
      return this.$route.path === routerById[data];
    }
  }
};
</script>

<style lang='less' scoped>
/* 引入公共样式 */
// @import '../../common/stylus/mixins.styl';
@import "../../util/themt.less";

.footer_guide {
  // 顶部有白色的边框
  position: fixed !important;
  z-index: 100;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #fff;
  width: 100%;
  height: 50px;
  display: flex;
  .top-border-1px(@border-base);
  .guide_item {
    display: flex;
    flex: 1;
    text-align: center;
    flex-direction: column;
    align-items: center;
    margin: 5px;
    color: #999999;
    &.on {
      color: @primary;
    }

    span {
      font-size: 12px;
      margin-top: 2px;
      margin-bottom: 2px;

      .iconfont {
        font-size: 22px;
      }
    }
  }
}

.item_icon {
  width: 22px;
  height: 22px;
  margin: 2px 0;
  img {
    max-width: 100%;
    max-height: 100%;
  }
}
</style>
